<?php

class News_model extends CI_Model {

    private $_table = 'news';
   
    public function get_news($params,$counter=false) {
        if(!$counter)
            {
                $query = $this->db->get($this->_table,PAGR_PER,$params['page']);
                return $query->result_array();
            }
        else{ 
                $query = $this->db->get($this->_table);
                return $query->num_rows();
            }
    }
    public  function get_where_news($params=NULL,$counter=FALSE){
        $where=array();
        if(isset($params['id']))
            $where['id']=$params['id'];
        
        if(!$counter)
            {
                $query=  $this->db->get_where($this->_table,$where);
                return $query->result_array();
            }
       else
            {
                $query=  $this->db->get_where($this->_table,$where);
                return $query->num_rows();    
            }
                
    }
   
    
}
